import collections
class Solution(object):
    def numSplits(self, s):
        d_t = collections.Counter(s)
        d_init = collections.defaultdict(int)
        ans = 0
        for c in s[:-1]:
            d_init[c] += 1
            d_t[c] -= 1
            if d_t[c] == 0:
                d_t.pop(c)
            if len(d_init) == len(d_t):
                ans += 1
        return ans
